package com.golddaymicromall.adapter;

import java.util.List;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;

import com.bumptech.glide.Glide;
import com.golddaymicromall.activity.R;
import com.golddaymicromall.bean.ProductDetailInfo;
import com.golddaymicromall.bean.ProductInfo;
import com.golddaymicromall.model.HttpModel;

public class GoodsValueLvAdapter extends BaseAdapter {

    private List<ProductInfo> list;
    private Context ctx;
    ListView lv;

    public GoodsValueLvAdapter(ListView lv , List<ProductInfo> list, Context ctx) {
        this.list = list;
        this.ctx = ctx;
        this.lv = lv;
    }


    @Override
    public int getCount() {
        // TODO Auto-generated method stub


        return list.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub

        return list.get(position);
    }

    @Override
    public long getItemId(int arg0) {
        // TODO Auto-generated method stub
        return arg0;
    }

    @Override
    public View getView(int position, View arg1, ViewGroup arg2) {

        arg1 = View.inflate(ctx, R.layout.item_goodsvaluelv, null);
        ImageView img = (ImageView) arg1.findViewById(R.id.GoodsValueItem_LvImg);
        if(ProductDetailInfo.threadFlag=true){
            Glide.with(ctx)
                    .load(new HttpModel().XINAGQINGIMGURL+list.get(position).getImage1())
                    .into(img);
        }

        return arg1;
    }

}